This invention pertains to image compression. More particularly this invention pertains to rate controlled lossy image compression.
In recent years, there has been an increase in interest in electronic imaging. Digital cameras that obviate the need for film development and provide instant access to photographs have proliferated. In digital cameras, images may be stored in a compressed digital file format on a memory medium. One widely used compressed image file format is commonly known as JPEG, which is an acronym for Joint Photographic Expert Group. The JPEG standard is officially designated ISO/IEC 10928 and is a joint standard of the International Telecommunication Union and the International Organization for Standardization.
Broadly speaking, JPEG compression typically works by subjecting 8 by 8 blocks of each color component of an image to a two dimensional discrete cosine transform (DCT) to obtain 8 by 8 matrices of transformed image coefficients. Note that the latter step alone does not result in any byte size reduction. All but one of the 64 transformed image coefficients are then quantized using quantums stored in one or more 8 by 8 quantizing matrices. Separate quantization matrices may be provided for each color channel. In quantizing, each transformed image coefficient is divided by a corresponding quantum from one of the quantization matrices, and the remainder after division is discarded. Quantizing reduces the number of bits needed to record image information at the expense of some degree of precision. Analogously, if a decimal number is divided by 10 and the remainder discarded the number of digits is reduced by 1. If the quotient of a transformed image coefficient and a corresponding quantum is less than the quantum, the quotient is set to zero. The quantization process may result in a large number of the 8 by 8 transformed image coefficients, usually coefficients corresponding to high spatial-frequency components, being set to zero. Setting a large number of coefficients to zero also leads to a reduction of the number of bits need to record image information. The quantums in the quantization matrices are selected in view of understood limits of visual acuity so that file compression may be achieved without incurring great loss in perceived image quality. The first coefficient of each 8 by 8 matrix of transformed image coefficients represents the average over the 8 by 8 image block from which it was derived. Exploiting the fact that the average varies slowly, the first coefficients of successive 8 by 8 matrices of transformed image coefficients are differentially encoded.
After quantization, the quantized transformed image coefficients in each 8 by 8 block are read out in a zigzag pattern that proceeds from low spatial frequency to high spatial frequency. Such an ordering increases the likelihood of long runs of zero coefficients. The coefficients are subsequently entropy encoded in a way that exploits the long runs of zeros.
One property of JPEG image compression is that for a fixed input image size, the size of the resulting JPEG compressed file is dependent on the nature of the image. For images with more fine detail fewer transformed image coefficients are set to zero by the quantization step and larger compressed image files result.
In digital camera applications, it is desirable to be able to guarantee that a fixed number of images will fit on a digital memory medium of predetermined capacity. Also for limited bandwidth communication networks it is desirable to limit the byte size of image files.
What is needed is a method of image compression that insures that compressed image files are about a predetermined byte size, independent of the level detail in the input images.